import pygame
from Map import Map
from base import BaseItem
import random

class Item(BaseItem):
    def __init__(self, left=300, top=360, path="img/star.gif"):
        super(Item, self).__init__()
        # 类型
        rand_type = random.randint(0,1)
        self.type = rand_type
        # 加载道具图片
        if self.type ==0:
            self.image = pygame.image.load("img/star.gif")
        if self.type ==1:
            self.image = pygame.image.load("img/timer.gif")
        # 获取墙壁的区域
        self.rect = self.image.get_rect()
        # 设置位置
        self.rect.left = left
        self.rect.top = top
        # 是否显示
        self.live = True